package com.ncp.servlet.product;

import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.ncp.model.biz.product.ManageFrontProductBiz;
import com.ncp.model.dao.DB;
import com.ncp.model.entity.product.ImgsUploadBean;

public class UploadProductImgsServlet extends HttpServlet {

	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		this.doPost(request, response);
		
	}

	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setContentType("text/html");
		request.setCharacterEncoding("utf-8");
		response.setCharacterEncoding("utf-8");
		String type = request.getParameter("type");
		 int PageSize=10;
		 int PageNow=1;
		 DB db = new DB();
		 db.setSql("select count(*) from PRODUCTBASIC");
		 int PageCount=db.getPageCount(PageSize);
		String s_PageNow = request.getParameter("PageNow");
		 if(s_PageNow!=null){
				PageNow=Integer.parseInt(s_PageNow);
			}
		ManageFrontProductBiz mfp = new ManageFrontProductBiz();
		String item="";
		String value="";
		
		
		List<ImgsUploadBean> img = mfp.getProductImgInfo();
		if(img==null){
			request.getRequestDispatcher("pages/admin/product/err.jsp").forward(request,response);	

			
		}else {
		request.setAttribute("PageCount", PageCount+"");
	    request.setAttribute("PageNow", PageNow+"");
		request.setAttribute("img",img);
		
		request.getRequestDispatcher("pages/admin/product/imgAdd.jsp").forward(request,response);	
		}
		
		
		
	}

}
